# Maintainer: Ivan Semkin (ivan at semkin dot ru)

pkgname=settings-components-git
_pkgname=settings-components
pkgver=r831.d66cac2
pkgrel=3
pkgdesc='Ubuntu settings components for Unity8'
url='https://github.com/ubports/settings-components'
arch=(x86_64 i686 armv7h aarch64)
license=(LGPL GPL)
conflicts=(settings-components)
provides=(settings-components)
depends=(xorg-server-xvfb qt5-quickcontrols)
makedepends=(git cmake cmake-extras-git)
source=('git+https://github.com/ubports/settings-components.git')
sha256sums=('SKIP')

BUILDENV+=('!check') # https://paste.ubuntu.com/p/gsfv2YX6Z5/
BUILD_DIR=build

prepare() {
  cd ${_pkgname}
  git checkout bionic
}

pkgver() {
  cd ${_pkgname}
  echo "r$(git rev-list --count HEAD).$(git describe --always)"
}

build() {
  cd ${_pkgname}
  mkdir -p ${BUILD_DIR}
  cd ${BUILD_DIR}
  cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_INSTALL_LIBDIR="lib/" ..
  make
}

check() {
  cd ${_pkgname}/${BUILD_DIR}
  make ARGS+="--output-on-failure" test
}

package() {
  cd ${_pkgname}/${BUILD_DIR}
  make DESTDIR="${pkgdir}/" install
  mv ${pkgdir}/usr/lib/qt5/ ${pkgdir}/usr/lib/qt/
}
# vim:set ts=2 sw=2 et:
